// here you can add code that should run on a client only
// please be aware that you may not use sleep and waitUntil in this script!!!
// if you need sleep and waitUntil use spawn and execVM from here
// the script runs shortly after the player is ingame before the intro starts
// everything in here is running in the same frame as x_client/x_setupclient.sqf to ensure that execution happens as fast as possible

// Code specific to the RHS Domination to remove weapons we can't use
0 spawn {
	waituntil { !isNull player };
	waituntil { player == player };
	if !((primaryWeapon player) in VAS_Weapons) then {
		private ["_weapon","_parents"];
		_weapon = primaryWeapon player;
		player removeWeapon _weapon;
		//diag_log ["Removing player weapon",_weapon];
		_parents = [(configFile >> "CfgWeapons" >> _weapon),true ] call BIS_fnc_returnParents;
		//diag_log ["Extracted weapon parents",_parents];
		if (typename _parents == typename [] && {count _parents > 1}) then {
			if (isClass (configFile >> "CfgWeapons" >> (_parents select 1)) && {getNumber (configFile >> "CfgWeapons" >> (_parents select 1) >> "scope") >= 2} && {(_parents select 1) in VAS_Weapons}) then {
				player addWeapon (_parents select 1);
				//diag_log ["Replacing player weapon",(_parents select 1)];
				sleep 2;
				player call d_fnc_removetech;
			};
		};
	};
};